package com.heima.user.controller.v1;

import com.heima.common.constants.UserConstants;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.user.dtos.AuthDto;
import com.heima.user.service.ApAuthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: heima-leadnews
 * @description:
 * @author: lydms
 * @create: 2024-04-11 11:46
 **/

@RestController
@RequestMapping("/api/v1/auth")
public class ApAuthController {

    @Autowired
    private ApAuthService apAuthService;

    @PostMapping("/list")
    public ResponseResult authList(@RequestBody AuthDto authDto){
        return apAuthService.authList(authDto);
    }

    @PostMapping("/authFail")
    public ResponseResult authFail(@RequestBody AuthDto authDto){
        return apAuthService.updateAuth(authDto, UserConstants.FAIL_AUTH);
    }

    @PostMapping("/authPass")
    public ResponseResult authPass(@RequestBody AuthDto authDto){
        return apAuthService.updateAuth(authDto, UserConstants.PASS_AUTH);
    }

}
